import React from 'react';
import { ts2Formatter,renderState,renderEnable } from 'utils';
import { actions } from 'mirrorx';
{/*
可配置化种类：

1、表格头部字段 
    1、列表页表格头部字段集合 mainTableColumn
    2、编辑页表格头部字段集合 childTableColumn

2、编辑框的字段
    1、编辑页 直接显示在页面的编辑字段 FormField
    2、编辑页 需要点击表格的增行弹框编辑的字段 FormTableField
    3. 列表页查询区域  searchField

3.表头部的按钮  headerButtonSets

4.表行尾部按钮  columnButtonSets
*/}

//表头信息

//字段属性

//基本信息
const FormDataHeader = [
    {
        enname: "billCode",
        zhname: "单据号",
        edit: false,
        hidepage:{0:true,3:true},
        type: "FormControl",
    },
    {
        enname: "organizationId",
        codename: "organizationCode",
        showname: "organizationName",
        zhname: "所属组织",
        type: "RefComponent",
        edit:true,
        refname:"organization",
        required: true,
        cascadeName: [{
            paramkey: "EQ_organization.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "organizationId",
            offers: "deptId",
            resetOffersFlag: true,
        }],
        cascadeChildTable:[{
            refKey: "refpk", 
            dtoKey: "organizationId",
            childType:"budgetPlanDetails" 
        }],
    },
    {
        enname: "planName",
        zhname: "预算方案名称",
        type: "FormControl",
        required: true,
        pattern: /^\S*$/,
        message: "不能有空格",
        edit: true,
    },
    {
        enname: "deptId",
        codename: "deptCode",
        showname: "deptName",
        zhname: "部门片区",
        type: "RefComponent",
        edit:true,
        refname:"departmentRef",
        required: true,
        alias:"organizationId"
    },
    {
        enname: "controlCycleId",
        codename: "controlCycleCode",
        showname: "controlCycleName",
        zhname: "控制周期",
        edit: true,
        type: "Select",
        code:"CONTROL_CYCLE",
        required: true,
    },
    {
        enname:"budgetDateStart",
        zhname:"预算开始时间",
        type: "DatePicker",
        format:"YYYY-MM-DD",
        edit: true,
        required: true,
    },
    {
        enname:"budgetDateEnd",
        zhname:"预算结束时间",
        type: "DatePicker",
        format:"YYYY-MM-DD",
        edit: true,
        required: true,
        disabledDate: "budgetDateStart",
    },
    {
        enname: "controlLevelId",
        codename: "controlLevelCode",
        showname: "controlLevelName",
        zhname: "控制力度",
        edit: true,
        type: "Select",
        code:"CONTROL_LEVEL",
        required: true,
    },
    {
        enname: "controlOrderId",
        codename: "controlOrderCode",
        showname: "controlOrderName",
        zhname: "控制单据",
        edit: true,
        type: "Select",
        code:"CONTROL_ORDER",
        required: true,
    },
    
    {
        enname: "controlTypeId",
        codename: "controlTypeCode",
        showname: "controlTypeName",
        zhname: "控制方式",
        edit: true,
        type: "Select",
        code:"CONTROL_TYPE",
        required: true,
        showcontrol:[
            {
                value: "01",
                refKey: "code",
                dtoKey: "controlTypeCode",
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["budgetStructureId"]
            },
            {
                value: "02",
                refKey: "code",
                dtoKey: "controlTypeCode",
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["saleStatisticBasisId"]
            }
        ]
    },
    {
        enname: "budgetStructureId",
        codename: "budgetStructureCode",
        showname: "budgetStructureName",
        zhname: "预算结转",
        edit: true,
        type: "Select",
        code:"BUDGET_STRUCTURE",
        required: true,
    },
    {
        enname: "budgetItemId",
        codename: "budgetItemCode",
        showname: "budgetItemName",
        zhname: "预算项目",
        edit: true,
        type: "RefComponent",
        refname:"budgetItemRef",
        required: true,
    },
    {
        enname: "budgetUnitId",
        codename: "budgetUnitCode",
        showname: "budgetUnitName",
        zhname: "预算单元",
        edit: false,
        type: "RefComponent",
        refname:"budgetUnitRef",
        required: true,
    },
    {
        enname: "budgetPriority",
        zhname: "预算优先级",
        type: "FormControl",
        required: false,
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "saleStatisticBasisId",
        codename: "saleStatisticBasisCode",
        showname: "saleStatisticBasisName",
        zhname: "销售统计依据",
        edit: true,
        type: "Select",
        code:"SALE_STATISTIC_BASIS",
        hidepage:{0:true},
        required: true,
    },
    {
        codename: "state",
        zhname: "审批状态",
        hidepage:{0:true},
        edit: false,
        code:"BILL_STATUS",
        type: "Select",
        required: false,
    },
    {
        enname:"approveTime",
        zhname:"审核日期",
        required: false,
        hidepage:{0:true},
        type: "DatePicker",
        format:"YYYY-MM-DD",
        edit: false
    },
    {
        enname:"isEnable",
        zhname:"启用状态",
        required: false,
        hidepage:{0:true},
        options: [{
            "key": 1,
            "value": "已启用"
        }, {
            "key": 2,
            "value": "停用"
        }],
        type: "Radio",
        edit: false
    },
    {
        enname: "ext01",
        zhname: "创建人",
        type: "FormControl",
        required: false,
        hidepage: { 0:true},
        edit: true,
    },
    {
        enname: "creationTime",
        zhname: "创建日期",
        type: "DatePicker",
        required: false,
        format: "YYYY-MM-DD",
        hidepage: { 0:true},
        edit: true,
    },
    {
        enname: "ext02",
        zhname: "编辑人",
        type: "FormControl",
        required: false,
        hidepage: { 0:true},
        edit: true,
    },
    {
        enname: "modifiedTime",
        zhname: "编辑日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        required: false,
        hidepage: { 0:true,3:true },
        edit: true,
    },
];

const columnbudgetPlanDetails = [
    {
        title: "公司",
        dataIndex: "saleOrgName",
        key: "saleOrgId",
        detailwidth: 250,
        required:true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            title: "公司",
            refName: "organization",
            constparam:{
                "AUTH_refdim": "organization", 
                "AUTH_refcod": "BudgetUnit",
            },
            aliasparam: [{
                paramkey: "EQ_id",
                alias: "organizationId",
            }],
            multiple:true,
            fieldName: "organizationName",
            reffields: { refpk: "saleOrgId", refcode: "saleOrgCode", refname: "saleOrgName" }
        },
    }, 
    {
        title: "部门",
        dataIndex: "departmentName",
        key: "departmentId",
        detailwidth: 250,
        required:true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            title: "部门",
            refName: "departmentRef",
            constparam:{
                "AUTH_refdim": "department", 
                "AUTH_refcod": "BudgetUnit",
            },
            aliasparam: [{
                paramkey: "EQ_organization.id",
                alias: "organizationId",
            }],
            multiple:true,
            fieldName: "departmentName",
            reffields: { refpk: "departmentId", refcode: "departmentCode", refname: "departmentName" }
        },
    },
    {
        title: "渠道",
        dataIndex: "channelName",
        key: "channelId",
        detailwidth: 250,
        required:true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            title: "渠道",
            refName: "custchantype",
            multiple:true,
            fieldName: "channelName",
            reffields: { refpk: "channelId", refcode: "channelCode", refname: "channelName" }
        },
    },
    {
        title: "客户",
        dataIndex: "customerName",
        key: "customerId",
        detailwidth: 250,
        required:true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            title: "客户",
            refName: "terminalcustomerRef",
            constparam:{
                "AUTH_refdim": "customer", 
                "AUTH_refcod": "BudgetUnit",
            },
            aliasparam: [{
                paramkey: "EQ_customerAreas.organization.id",
                alias: "organizationId",
            }],
            multiple:true,
            fieldName: "customerName",
            reffields: { refpk: "customerId", refcode: "customerCode", refname: "customerName" }
        },
    },
    {
        title: "门店",
        dataIndex: "terminalStoreName",
        key: "terminalStoreId",
        detailwidth: 250,
        required:true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            title: "门店",
            refName: "terminal",
            constparam:{
                "AUTH_refdim": "termianl", 
                "AUTH_refcod": "BudgetUnit",
            },
            aliasparam: [{
                paramkey: "EQ_organization.id",
                alias: "organizationId",
            }],
            multiple:true,
            fieldName: "terminalStoreName",
            reffields: { refpk: "terminalStoreId", refcode: "terminalStoreCode", refname: "terminalStoreName" }
        },
    },
    {
        dataIndex: "amount1",
        key: "amount1",
        title: "1期费用金额",
        detailwidth: 100,
        required:true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount1",
        key: "planSaleAmount1",
        title: "1期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            precision:0
        }
    },
    {
        dataIndex: "planRetailAmount1",
        key: "planRetailAmount1",
        title: "1期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate1",
        key: "rate1",
        title: "1期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount2",
        key: "amount2",
        title: "2期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount2",
        key: "planSaleAmount2",
        title: "2期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount2",
        key: "planRetailAmount2",
        title: "2期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate2",
        key: "rate2",
        title: "2期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount3",
        key: "amount3",
        title: "3期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount3",
        key: "planSaleAmount3",
        title: "3期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount3",
        key: "planRetailAmount3",
        title: "3期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate3",
        key: "rate3",
        title: "3期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount4",
        key: "amount4",
        title: "4期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount4",
        key: "planSaleAmount4",
        title: "4期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount4",
        key: "planRetailAmount4",
        title: "4期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate4",
        key: "rate4",
        title: "4期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount5",
        key: "amount5",
        title: "5期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount5",
        key: "planSaleAmount5",
        title: "5期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount5",
        key: "planRetailAmount5",
        title: "5期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate5",
        key: "rate5",
        title: "5期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount6",
        key: "amount6",
        title: "6期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount6",
        key: "planSaleAmount6",
        title: "6期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount6",
        key: "planRetailAmount6",
        title: "6期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate6",
        key: "rate6",
        title: "6期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount7",
        key: "amount7",
        title: "7期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount7",
        key: "planSaleAmount7",
        title: "7期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount7",
        key: "planRetailAmount7",
        title: "7期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate7",
        key: "rate7",
        title: "7期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        dataIndex: "amount8",
        key: "amount8",
        title: "8期费用金额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount8",
        key: "planSaleAmount8",
        title: "8期计划销售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount8",
        key: "planRetailAmount8",
        title: "8期计划零售额",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate8",
        key: "rate8",
        title: "8期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        title: "9期费用金额",
        dataIndex: "amount9",
        key: "amount9",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount9",
        key: "planSaleAmount9",
        title: "9期计划销售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount9",
        key: "planRetailAmount9",
        title: "9期计划零售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate9",
        key: "rate9",
        title: "9期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        title: "10期费用金额",
        dataIndex: "amount10",
        key: "amount10",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount10",
        key: "planSaleAmount10",
        title: "10期计划销售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount10",
        key: "planRetailAmount10",
        title: "10期计划零售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate10",
        key: "rate10",
        title: "10期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        title: "11期费用金额",
        dataIndex: "amount11",
        key: "amount11",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount11",
        key: "planSaleAmount11",
        title: "11期计划销售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount11",
        key: "planRetailAmount11",
        title: "11期计划零售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate11",
        key: "rate11",
        title: "11期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
    {
        title: "12期费用金额",
        dataIndex: "amount12",
        key: "amount12",
        detailwidth: 100,
        required: true,
        edit: true,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planSaleAmount12",
        key: "planSaleAmount12",
        title: "12期计划销售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "planRetailAmount12",
        key: "planRetailAmount12",
        title: "12期计划零售额",
        detailwidth: 100,
        required: true,
        edit: false,
        renderType: "inputnumber",
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
        }
    },
    {
        dataIndex: "rate12",
        key: "rate12",
        title: "12期累计费用率",
        detailwidth: 100,
        edit: true,
        hidepage: { 0: true, 1: true, 2: true },
        filedProps: {
            min: 0,
            max: 100
        }
    },
]

//表单字段
export const FormField = {
    "DataHeader": {
        "title": "基础信息",
        "Field": FormDataHeader
    },
}

//表格弹框表单字段
export const FormTableField = {
}

//渲染成字表表格的头
export const childTableColumn = {
    "budgetPlanDetails": {
        "title": "预算方案明细",
        "type": "grid",
        "column": columnbudgetPlanDetails
    },
}

//渲染成字表表格的头
export const mainTableColumn = [
    {
        title: "单据号",
        dataIndex: "billCode",
        width: 150,
        key: "billCode",
        render: (text, record) => {
            return <a style={{ "cursor": "pointer" }}
                onClick={() => {
                    actions.routing.push(
                        {
                            pathname: 'BudgetPlan-edit',
                            search: `?search_id=${record.id}&btnPageFlag=2`,
                        }
                    );
                    // location.reload();
                }}
            >
                {text}
            </a >;
        }
    },
    {
        title: "所属组织",
        dataIndex: "organizationName",
        key: "organizationName",
    },
    {
        title: "预算名称",
        dataIndex: "planName",
        key: "planName",
    },
    {
        title: "部门片区",
        dataIndex: "deptName",
        key: "deptName",
    },
    {
        title: "预算开始时间",
        dataIndex: "budgetDateStart",
        key: "budgetDateStart",
        width: 120,
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    {
        title: "预算结束时间",
        dataIndex: "budgetDateEnd",
        key: "budgetDateEnd",
        width: 120,
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    {
        title: "控制周期",
        width: 120,
        dataIndex: "controlCycleName",
        key: "controlCycleName",
    },
    {
        title: "审批状态",
        dataIndex: "state",
        key: "state",
        width: 70,
        render:(text, record, index)=> {
            return renderState(text);
        },
    },
    {
        title:"审核日期",
        dataIndex:"approveTime",
        key: "approveTime",
        width: 90,
        render:(text) => {
            return text && ts2Formatter(text);
        },
    },
    {
        title: "启停状态",
        width: 50,
        dataIndex: "isEnable",
        key: "isEnable",
        render:(text, record, index)=> {
            if(text=="1"){
                return "启用";
            }else{
                return "停用";
            }
        },
    },
    {
        title: "控制力度",
        width: 120,
        dataIndex: "controlLevelName",
        key: "controlLevelName",
    },
    {
        title: "控制单据",
        width: 120,
        dataIndex: "controlOrderName",
        key: "controlOrderName",
    },
    {
        title: "预算结转",
        width: 120,
        dataIndex: "budgetStructureName",
        key: "budgetStructureName",
    },
    {
        title: "控制方式",
        width: 120,
        dataIndex: "controlTypeName",
        key: "controlTypeName",
    },
    {
        title: "预算项目",
        width: 120,
        dataIndex: "budgetItemName",
        key: "budgetItemName",
    },
    {
        title: "创建人",
        width: 120,
        dataIndex: "ext01",
        key: "ext01",
    },
    {
        title: "创建日期",
        dataIndex: "creationTime",
        key: "creationTime",
        width: 120,
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    {
        title: "修改人",
        width: 120,
        dataIndex: "ext02",
        key: "ext02",
    },
    {
        title: "修改日期",
        dataIndex: "modifiedTime",
        key: "modifiedTime",
        width: 120,
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
]

export const searchField = [
    {
        enname: "creationTime",
        zhname: "制单日期",
        required: false,
        type: "RangePicker",
        rangeField: ["creationTime", "creationTime"],
        edit: true
    },
    {
        enname: "billCode",
        zhname: "单据号",
        required: false,
        type: "FormControl",
        searchType:"like",
        edit: true
    },
    {
        enname: "organization",
        zhname: "所属组织",
        required: false,
        refname:"organization",
        realRef:true,
        param:{
            "AUTH_refdim": "organization", 
            "AUTH_refcod": "ExpenseSummary"
        },
        type: "RefComponent",
        edit: true
    },
    {
        enname:"state",
        zhname:"审批状态",
        required: false,
        code:"BILL_STATUS",
        type: "Select",
        edit: true
    },
]

export const headerButtonSets = [
    // {
    //     event: "ButtonAdd",
    //     zhname: "新增",
    //     color: 'primary',
    //     authcode: "9901-05-02-01",
    // }
    {
        event: "ButtonEnable",
        zhname: "启用",
        authcode: "BudgetPlanstart",
        method: "post",
        batch:true,
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/budget-plans/batch-enable'
    },
    {
        event: "ButtonDisable",
        zhname: "停用",
        authcode: "BudgetPlanstop",
        method: "post",
        batch:true,
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/budget-plans/batch-disable'
    }
]

export const columnButtonSets = {
    "delete": {
        event: "ButtonDel",
        zhname: "删除",
        batch: true,
        method: "post",
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/budget-plans/deleteWithFriendly'
    },
    "edit": true,
    "detail": true
}

// export default {mainTableColumn,searchField,headerButtonSets,
//     columnButtonSets,childTableColumn,FormTableField,FormField}
export const SelectCode = ["BILL_STATUS","BUDGETDIMENSION","BUDGETCLASSIFICATION","CONTROL_CYCLE","CONTROL_LEVEL","CONTROL_TYPE","CONTROL_ORDER","BUDGET_STRUCTURE","SALE_STATISTIC_BASIS"]
